import request from '@/utils/request'
import qs from 'qs'

export function initData(url, params,methodStr) {
  let data = {}
  if(methodStr && methodStr.toLowerCase() === 'post'){
    data.url = url
    data.data = params
  }else{
    data.url = url + '?' + qs.stringify(params, { indices: false })
  }
  data.method = methodStr ? methodStr : 'get'
  return request(data)
}

export function download(url, params) {
  return request({
    url: url + '?' + qs.stringify(params, { indices: false }),
    method: 'get',
    responseType: 'blob'
  })
}
